<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class Role extends Model
{
    //1。关联的表

    public $table = 'role';

    //2.主键
    public $primaryKey = 'id';

    //3.允许批量操作的字段
    //public $fillable = ['role_name','user_pass','email','phone'];
    public $guarded = [];

    //是否维护 create_at 和 update_at
    public $timestamps = false;
    //关联数据表模型
    public function Permission()
    {
        return $this->belongsToMany('App\Model\Permission','role_permission','role_id','permission_id');
    }
}
